package com.liuceng.zen.common.utils;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.NumberFormat;

public class MoneyUtils {

  public static String moneyFormat(BigDecimal input) {
    return moneyFormat(input, "￥,###.###");
  }

  public static String moneyFormat(BigDecimal input, String str) {
    if (input == null) {
      return "-";
    }
    NumberFormat nf = new DecimalFormat(str);
    nf.setRoundingMode(RoundingMode.DOWN);
    return nf.format(input);
  }
}
